package com.permission.model;

import com.fasterxml.jackson.annotation.*;
import com.solution.framework.model.BaseBean;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
* Created with generator tools.
* User: sunguangzhu
* DateTime:2014-04-28 09:39:14
*/
@Entity
@Table(name = "t_p_role")
public class PRole extends BaseBean implements java.io.Serializable {

/**
* 名称
*/
private java.lang.String name;

/**
* 用户角色集合
*/
private java.util.Set<com.permission.model.PUserRole> pUserRoles;

/**
* 角色资源集合
*/
private java.util.Set<com.permission.model.PRoleResource> pRoleResources;

/** default constructor */
public PRole() {
}

/**
* full constructor
* @param name
* @param pUserRoles
* @param pRoleResources
*/
public PRole(java.lang.String name,java.util.Set<com.permission.model.PUserRole> pUserRoles,java.util.Set<com.permission.model.PRoleResource> pRoleResources) {
this.name=name;
this.pUserRoles=pUserRoles;
this.pRoleResources=pRoleResources;
}

/**
*  getter
*/
    @Column
public java.lang.String getName() {
return this.name;
}

/**
* setter
* @param name
*/
public void setName(java.lang.String name) {
this.name = name;
}

/**
*  getter
*/
    @JsonBackReference
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "PRole")
public java.util.Set<com.permission.model.PUserRole> getPUserRoles() {
return this.pUserRoles;
}

/**
* setter
* @param pUserRoles
*/
public void setPUserRoles(java.util.Set<com.permission.model.PUserRole> pUserRoles) {
this.pUserRoles = pUserRoles;
}

/**
*  getter
*/
    @JsonBackReference
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "PRole")
public java.util.Set<com.permission.model.PRoleResource> getPRoleResources() {
return this.pRoleResources;
}

/**
* setter
* @param pRoleResources
*/
public void setPRoleResources(java.util.Set<com.permission.model.PRoleResource> pRoleResources) {
this.pRoleResources = pRoleResources;
}

}
